

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * Class for testing Courses
 * @author Al McKenzie
 *
 */
public class testCourses
{
    Courses c;
    List<Course> t;

    @Before
    public void setUp() throws Exception
    {
        c = new Courses("schedule.csv");
        t = new ArrayList<Course>();
        t.addAll(c.getCourses());
        
        System.out.println(t.toString());
    }

    
    @Test
    public void test()
    {
        //test credits
        assertEquals(5, t.get(0).getCredits());
        
        //test instuructor
        assertEquals("ZHIYAN", t.get(0).getInstructor("A"));
        assertEquals("WILLS", t.get(3).getInstructor("B"));
        
        //test set sections names
        List<String> cha = new ArrayList<String>();
        cha.addAll(Arrays.asList(t.get(0).getSectionNames()));
        assertTrue(cha.contains("A"));
        assertTrue(cha.contains("B"));
        assertTrue(cha.contains("C"));
        
        //get days
        assertEquals("MW", t.get(0).getDays("A"));
        assertEquals("TR", t.get(3).getDays("B"));
        
        
        //start time
        assertEquals("stimea", 1330, t.get(0).getStartTime("A" ));
        
        assertEquals("stimeb", 1020, t.get(3).getStartTime("B"));
        
        //end time
        assertEquals("etimea", 1535, t.get(0).getEndTime("A") );
        assertEquals("etimeb", 1225, t.get(3).getEndTime("B") );
        
        //get title
        assertEquals("FINANCIAL ACCT I", t.get(0).getTitle());
        
        //get couseID
        assertEquals("TACCT210", t.get(0).getId());
        
    }
    
    
    
    
    
    
    
    @After
    public void tearDown() throws Exception
    {
        c = null;
    }

}
